package com.bootdo.repertory.controller;


import com.bootdo.common.utils.R;
import com.bootdo.repertory.dao.CcpDao;
import com.bootdo.repertory.domain.CcpDO;
import com.bootdo.repertory.service.CcpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 套餐关联表
 * 
 * @author mp
 * @email 1992lcg@163.com
 * @date 2020-03-02 09:22:07
 */
 
@Controller
@RequestMapping("/repertory/ccp")
public class CcpController {
	@Autowired
	private CcpService ccpService;
	
	@GetMapping()
	String Cp(){
	    return "sell/cp/cp";
	}


	@ResponseBody
	@PostMapping("/save")
	public R save(CcpDO cp){
		if(ccpService.save(cp)>0){
			return R.ok();
		}
		return R.error();
	}



	/**
	 * 修改
	 */
	@ResponseBody
	@RequestMapping("/update")
	/*	@RequiresPermissions("sell:cp:edit")*/
	public R update(CcpDao cp){
		ccpService.update(cp);
		return R.ok();
	}



	/**
	 * 删除
	 */
	@PostMapping( "/remove")
	@ResponseBody
	/*	@RequiresPermissions("sell:cp:remove")*/
	public R remove(Integer cid){
		if(ccpService.remove(cid)>0){
			return R.ok();
		}
		return R.error();
	}
}
